layui.use(['table', 'layer', 'form', 'jquery', 'card'], function() {

        let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;
        let layer = layui.layer;
        let card = layui.card;

        card.render({
            elem: '#homeTheme',
            url: './template/getListData', // 接口数据
            data: [],
            page: true, // 是否分页
            limit: 8, // 每页数量
            linenum: 4, // 每行数量
            clickItem: function(data) { // 单击事件
                var index = layer.msg('正在切换模板,请稍后...', {
                icon: 16,
                time: 3000
            });
            layer.close(index);
            layer.msg('正在切换模板请稍后...', {
                icon: 6,
                time: 3000
            }, function() {
                $.post('/h/ajax/Set', {
                        template: data.title
                    },
                    function(data) {
                        if (data.code == 1) {
                            layer.alert('更换模板成功！', {
                                icon: 1,
                                closeBtn: false
                            }, function() {
                                window.location.reload()
                            });
                        } else {
                            layer.alert(data.msg, {
                                icon: 2
                            })
                        }
                        return false;
                    }, "json");
            });
            return false;
            }
        })
    });